/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tiketBioskop.entity;

import com.tiketBioskop.koneksi.koneksiDataBase;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


/**
 *
 * @author sepha
 */
public class pegawai {

    public String nama;
    public String password;

    public pegawai() {
    }

    public pegawai(String nama, String password) {
        this.nama = nama;
        this.password = password;
    }

    public String getNama() {
        return nama;
    }

    public void setNama(String nama) {
        this.nama = nama;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    //logika login
    public boolean pegawaiLogin(String namaPegawai) throws SQLException {
        Statement st = koneksiDataBase.getConnection().createStatement();
        ResultSet rs = st.executeQuery("SELECT namaPegawai, passwordPegawai FROM akunPegawai WHERE namaPegawai='"+namaPegawai+"'");
        while (rs.next()) {
            setNama(rs.getString("namaPegawai"));
            setPassword(rs.getString("passwordPegawai"));
        }
//        st.close();
        return true;
    }
}
